//
//  CustomTipUIViewController.m
//  MobileAppsTipApp
//
//  Created by jcotter on 10/10/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "CustomTipUIViewController.h"


@implementation CustomTipUIViewController

@synthesize label_TipTotal, label_GrandTotal, tv_customTips;
@synthesize m_ctsp1;
@synthesize m_ctsp2;
@synthesize m_ctsp3;
@synthesize m_ctsp4;
@synthesize m_ctsp5;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)dealloc
{
    [super dealloc];
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    ((CustomTipSubPanel*)m_ctsp1).parentCustomTipView = self;
    ((CustomTipSubPanel*)m_ctsp2).parentCustomTipView = self;
    ((CustomTipSubPanel*)m_ctsp3).parentCustomTipView = self;
    ((CustomTipSubPanel*)m_ctsp4).parentCustomTipView = self;
    ((CustomTipSubPanel*)m_ctsp5).parentCustomTipView = self;   
     
    
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}


-(void) updateUI
{
    label_TipTotal.text = @"test";
    label_GrandTotal.text = [NSString stringWithFormat:@"%d", random()];
}
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
    [((CustomTipSubPanel*)m_ctsp1).textField_Subtotal resignFirstResponder];
    [m_ctsp2 resignFirstResponder];
    [m_ctsp3 resignFirstResponder];
    [m_ctsp4 resignFirstResponder];
    [m_ctsp5 resignFirstResponder];
}



@end
